<?php

namespace App\Models;

class OrderHistoryModel extends RbhBaseModel
{
    protected $table = 'df_order_history';

    protected $guarded = [];

    /**
     * 创建订单历史操作记录
     * @param $order
     * @return
     */
    public static function createHistoryOrder($order) {
        $binaryStatus = $order->finish_stauts . $order->refund_status . $order->done_status
            . $order->express_status . $order->pay_status;
        $statusText = OrderModel::getOrderStatusText($order);
        return self::create([
            'order_no'    => $order->order_no,
            'status'      => $binaryStatus,
            'status_text' => $statusText
        ]);
    }
}
